package com.example.transaction_springboot.controller;

import com.example.transaction_springboot.common.Result;
import com.example.transaction_springboot.controller.dto.AdminDTO;
import com.example.transaction_springboot.controller.request.LoginRequest;
import com.example.transaction_springboot.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private AdminService adminService;

    @PostMapping("/login")
    public Result login(@RequestBody LoginRequest loginRequest){
        AdminDTO adminDTO = adminService.login(loginRequest);
        return Result.success(adminDTO);
    }

}
